/*==========================================================================
 *
 *  Copyright (C) 1995 Microsoft Corporation. All Rights Reserved.
 *
 *  File:       Assert.h
 *  Content:    assert header
 *
 ***************************************************************************/
#ifndef __ASSERT_INCLUDED__
#define __ASSERT_INCLUDED__

#ifdef _DEBUG
#define _ASSERT_      // Enable the Assert() macro
#endif

#include <windows.h>

// display error message and quit at last
// hwnd		:	hangle window to display error
// code		:	error code
// message	:	error message
// filename	:	if the message needs filename, the filename
void ErrorMessage( HWND hwnd, int code, LPCTSTR message, LPCTSTR filename=NULL);

///////////
// display error message without quit the process
// hwnd		:	hangle window to display error
// code		:	error code
// message	:	error message
// filename	:	if the message needs filename, the filename
void ErrorMessageNoQuit( HWND hwnd, int code, LPCTSTR message, LPCTSTR filename=NULL);

// output debug message
// nNum		:	value to output
// pStr		:	devide symbles after the value
// nHex		:	decimal or hex value to display
void OutputString( int nNum, const char *pStr, int nHex = 10 );

void WriteLogFile( LPCTSTR filename, LPCTSTR str );

//added by tian yue.
void WriteErrorFile(LPCTSTR filename,WORD str);

#ifdef _ASSERT_

void AssertFail(const char [], const char [], int, char[]);
#define Assert(f) ((f) ? (void)NULL : (void)AssertFail(#f, __FILE__, __LINE__,NULL))
#define AssertMessage(f, szMessage) ((f) ? (void)NULL : (void)AssertFail(#f, __FILE__, __LINE__, szMessage))

#else
#define Assert(f) (void)NULL        // Macro that does nothing
#define AssertMessage(f, szMessage) (void)NULL  

#endif // ~ASSERT

#endif
